amends "../snippetTest.pkl"

examples {
  ["getClass()"] {
    1.getClass().simpleName
    1.2.getClass().simpleName
    true.getClass().simpleName
    "hello".getClass().simpleName
    5.min.getClass().simpleName
    5.mb.getClass().simpleName
    List(1, 2, 3).getClass().simpleName
    Map("one", 1, "two", 2).getClass().simpleName
    new Listing { 1; 2; 3 }.getClass().simpleName
    new Mapping { ["one"] = 1; ["two"] = 2 }.getClass().simpleName
    new Dynamic { x = 1; y = 2 }.getClass().simpleName
    new Person { name = "Pigeon" }.getClass().simpleName
    Person.getClass().simpleName
    null.getClass().simpleName
    Pair(1, 2).getClass().simpleName
    import("pkl:base").getClass().simpleName
  }

  ["ifNonNull"] {
    local s = 10

    s.ifNonNull((x) -> x)
    s.ifNonNull((x) -> "foo")
    s.ifNonNull((x) -> null)

    null.ifNonNull((x) -> x)
    null.ifNonNull((x) -> "foo")
    null.ifNonNull((x) -> null)
  }

  ["toString()"] {
    "Pigeon".toString()
    42.toString()
    1.23.toString()
    true.toString()
    1.23.ns.toString()
    1.23.mb.toString()
    Pair(1, 2).toString()
    List(1, 2, 3).toString()
    Set(1, 2, 3).toString()
    Map(1, 2, 3, 4).toString()
    new Listing { 1 2 3 }.toString()
    new Mapping { ["Pigeon"] = 42; ["Barn Owl"] = 21 }.toString()
    new Dynamic { name = "Pigeon"; age = 42 }.toString()
    new Person2 { name = "Pigeon"; age = 42 }.toString()
    null.toString()
    Null(new Dynamic { name = "Pigeon" }).toString()
  }
}

local class Person {
  name: String
}

local class Person2 {
  name: String
  age: Int
}
